package de.chessgame.gamelogic.piece;

public enum Type {
	KING, QUEEN, ROOK, KNIGHT, BISHOP, PAWN;

	public static Type idToType(int id) {
		switch (id) {
		case 0:
			return KING;

		case 1:
			return QUEEN;

		case 2:
			return ROOK;

		case 3:
			return KNIGHT;

		case 4:
			return BISHOP;

		case 5:
			return PAWN;

		case 6:
			return null;

		default:
			return null;
		}

	}

	public static int typeToId(Type type) {
		if (type == null) {
			return 6;
		}
		
		switch (type) {
		case KING:
			return 0;

		case QUEEN:
			return 1;

		case ROOK:
			return 2;

		case KNIGHT:
			return 3;

		case BISHOP:
			return 4;

		case PAWN:
			return 5;

		default:
			return -1;
		}
	}
};
